package Java100_1006.operations;

import Java100_1006.Book;
import Java100_1006.BookDao;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class FindOperation implements IOperation{
    @Override
    public void work() {
        System.out.println("根据名字查找书籍!");
        System.out.println("请输入要查找的书名: ");
        Scanner scanner = new Scanner(System.in);
        String bookName = scanner.next();
        BookDao bookDao = new BookDao();
        List<Book> books = bookDao.selectByName(bookName);
        for(Book book:books){
            System.out.println(book);
        }
        System.out.println("根据名字查找书籍完毕!");
    }
}
